/*
 * @Author: your name
 * @Date: 2021-10-11 15:50:00
 * @LastEditTime: 2022-02-18 15:39:20
 * @LastEditors: Please set LastEditors
 * @Description: 申诉管理数据封装
 * @FilePath: \工作项目\ebc-admin\src\views\report\config\appeal.comfig.js
 * 
 */
// 公共方法
import { asyncApiFun } from "@/utils/utils.js";
// 接口
import { reportReasonList } from "@/api/report.js";
export const listHeader = [
  { prop: 'appealId', label: '申诉编号'},
  { prop: 'appealType', label: '申诉类型', isTemplate: true},
  { prop: 'reportReasonName', label: '举报原因'},
  { prop: 'appellantName', label: '申诉人' },
  { prop: 'appealState', label: '状态', isTemplate: true },
  { prop: 'appealTime', label: '申诉时间' },
  { prop: 'auditorName', label: '审核人'},
  { prop: 'auditTime', label: '审核时间' },
  { prop: 'operat', label: '操作', isTemplate: true }
]
const type = [
  { value: '1', title: '个人申诉' },
  { value: '4', title: '组织申诉' },
  
]
const stutas = [
  { value: '0', title: '待审核' },
  { value: '1', title: '已同意' },
  { value: '2', title: '已拒绝' }
]

// 举报原因
const reason = [
  { value: '0',label: '聊天(群聊)举报', children:[]},
  { value: '1',label: '动态举报', children:[]},
  { value: '2',label: '个（组织）名片举报', children:[] }
]
const props = {
  expandTrigger: 'hover',
  lazy: true,
  async lazyLoad (node, resolve) {
    // 举报类型
    let type = node.data.value;
    const list = []
    // 网络请求
    const [res] = await asyncApiFun(reportReasonList,type)
    if(res) {
      res.data.filter(item => {
        list.push({
          value:item.settingsId,
          label:item.settingsName,
          leaf:true
        })
      })
    }
    resolve(list);
  }
}
// 搜索框
export const searchs = [
  { type: 'input', key: 'appealId', value: '', placeholder: '申诉编号' },
  { type: 'select', key: 'appealType', value: '', selectList: type, placeholder: '申诉类型' },
  { type: 'cascader', key: 'reportReason', value: '', options: reason ,props:props, placeholder: '举报原因' },
  { type: 'select', key: 'appealState' ,value: '' ,selectList: stutas,placeholder: '状态'}
]
// 审核弹窗数据配置
export const textLists = [
  { type: 'txt', key: 'reportReasonName',span: 24, title: '举报原因: ' },
  { type: 'txt', key: 'reportContent',span: 24, title: '举报内容: ' },
  { type: 'image-group', key: 'reportPicture',span: 24,  title: '举报截图: '},
  { type: 'txt', key: 'appealType',  title: '申诉类型: ',
    valHandle(data){
      return data[this.key] = data[this.key] === '1' ? '个人申述' : '组织申述'
      
    } },
  { type: 'txt', key: 'appealReason', span: 24, title: '申述内容: ' },
  { type: 'image-group', key: 'appealImages',span: 24, title: '申诉截图: ' },
]
// 审核拒绝弹窗数据配置
export const editList = [
  { type: 'textarea', key: 'reason', label: '拒绝原因', placeholder: '请输入' }
]
// 审核拒绝弹窗规则配置
export const rules = {
  reason: { required: true, message: '请输入拒绝原因' }
}